home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 117 / 117.d81 / toolbox 117.s < prev    next >
Text File  |  2022-08-26  |  21KB  |  2,039 lines

  1. open =$ffc0
  2. readst =$ffb7
  3. setlfs =$ffba
  4. setnam =$ffbd
  5. setmsg =$ff90
  6. load =$ffd5
  7. getin =$ffe4
  8. input'buffer =512
  9. clrchn =$ffcc
  10. close =$ffc3   ;a
  11. chrin =$ffcf
  12. chkout =$ffc9  ;x
  13. chkin =$ffc6   ;x
  14. plot =$fff0
  15. chrout =$ffd2
  16. color'pointer =243
  17. screen'line'pointer =209
  18. print'number =$bdcd ;x,a
  19. clear'line =59903
  20. background =53281
  21. border =53280
  22. strout = $ab1e; .A low .Y high
  23. unlisten =$ffae
  24. clall =$ffe7
  25. color1 =53282
  26. color2 =53283
  27. color3 =53284
  28. white =5
  29. crsr'down =17
  30. rvs'on =18
  31. home =19
  32. del =20
  33. red =28
  34. crsr'right =29
  35. green =30
  36. blue =31
  37. black =144
  38. lowercase =14
  39. uppercase =142
  40. crsr'up =145
  41. rvs'off =146
  42. clr =147
  43. insert =148
  44. brown =149
  45. light'red =150
  46. dark'grey =151
  47. medium'grey =152
  48. light'green =153
  49. light'blue =154
  50. light'grey =155
  51. purple =156
  52. crsr'left =157
  53. yellow =158
  54. cyan =159
  55. top'left =176
  56. top'right =174
  57. bottom'left =173
  58. bottom'right =189
  59.  
  60. .org $9000
  61. .obj "toolbox117 9000"
  62. ;mem
  63. jmp menu'entry
  64. jmp box'entry;;    3
  65. jmp screen'stash;  6
  66. jmp screen'restore;9
  67. jmp linx;          12
  68. jmp print'at;15
  69. jmp center;18
  70. jmp ucase;21
  71. jmp lcase;24
  72. jmp load'file;27
  73. jmp read'existing;30
  74. jmp screen'merge;33
  75. jmp char'swap;36
  76. jmp color'swap;39
  77. jmp shade'area;42
  78. jmp directory;45
  79. jmp brancher;48
  80. jmp bload;51
  81. jmp frame'entry;54
  82. jmp get'scroll'up;57
  83. jmp get'scroll'down;60
  84. jmp clear'row;63
  85.  
  86.  
  87. ;sys,addr y,x1,x2,number items,text,highlight,esc
  88.  
  89. ;***sys addr,x,to x,y,to y,s-code,color
  90.  
  91. box'entry lda #5
  92. sta parm'count
  93. lda #0
  94. sta shade
  95. box'ii lda #0
  96. sta temp
  97. - jsr get'number
  98. tya
  99. ldy temp
  100. sta box'parameters,y
  101. inc temp
  102. cpy parm'count
  103. bne -
  104.  
  105. fill'box jsr linx
  106. lda 214
  107. pha
  108. lda 211
  109. pha
  110. box'start ldx box'parameters+2
  111. ldy #0
  112. clc
  113. jsr $fff0
  114. jsr old'rom'patch
  115. dec box'parameters
  116. ;inc box'parameters+3
  117.  
  118. - ldy box'parameters+1
  119. - lda box'parameters+4
  120. bit shade
  121. bmi get'shade
  122. cmp #255
  123. beq +
  124. sta (209),y
  125. + lda box'parameters+5
  126. store'color sta (243),y
  127. dey
  128. cpy box'parameters
  129. bne -
  130. lda 214
  131. cmp box'parameters+3
  132. beq +
  133.  
  134. inc 214
  135. jsr 58732
  136. jsr old'rom'patch
  137. jmp --
  138. + lda #home
  139. jsr $ffd2
  140. pla
  141. sta 211
  142. pla
  143. sta 214
  144. lda #0
  145. sta shade
  146. jmp 58732
  147.  
  148. linx ldy #24
  149. - lda 217,y
  150. ora #128
  151. sta 217,y
  152. dey
  153. bpl -
  154. rts
  155.  
  156. get'shade lda (243),y
  157. and #15
  158. tax
  159. lda shade'table,x
  160. jmp store'color
  161.  
  162. screen'stash sec
  163. jsr plot
  164. stx menuy
  165. sty menux1
  166.  
  167. jsr get'number
  168. sty 252
  169. tya
  170. cpy >1024
  171. bcs +
  172. rts
  173.  
  174. + clc
  175. adc #4
  176. sta 254
  177. lda #0
  178. sta 253
  179. sta 251
  180.  
  181. lda #home
  182. jsr chrout
  183. jsr old'rom'patch
  184. sei
  185. lda #0
  186. sta 1
  187.  
  188. ldx #3
  189. ldy #0
  190. - lda (209),y
  191. sta (251),y
  192. dec 1
  193. lda (243),y
  194. inc 1
  195. sta (253),y
  196. iny
  197. bne -
  198. inc 210
  199. inc 252
  200. inc 244
  201. inc 254
  202. dex
  203. bpl -
  204. dec 254
  205. ldy #233
  206. dec 1
  207. lda 53280
  208. inc 1
  209. sta (253),y
  210. iny
  211. dec 1
  212. lda 53281
  213. inc 1
  214. sta (253),y
  215. iny
  216. lda menuy
  217. sta (253),y
  218. iny
  219. lda menux1
  220. sta (253),y
  221. lda #$77
  222. sta 1
  223. cli
  224. ldy menux1
  225. ldx menuy
  226. clc
  227. jmp plot
  228.  
  229. screen'restore lda #0
  230. sta merge
  231. restore'ii jsr get'number
  232. sty 252
  233. tya
  234. clc
  235. adc #4
  236. sta 254
  237. lda #0
  238. sta 253
  239. sta 251
  240.  
  241. lda #home
  242. jsr chrout
  243. jsr old'rom'patch
  244. sei
  245. lda #0
  246. sta 1
  247.  
  248. ldx #3
  249. ldy #0
  250.  
  251. - lda (209),y
  252. sta temp
  253.  
  254. bit merge
  255. bpl no'merge
  256. lda temp
  257. and #%10111111
  258. cmp #32
  259. bne skip
  260.  
  261. no'merge lda (251),y
  262. sta (209),y
  263. lda (253),y
  264. dec 1
  265. sta (243),y
  266. inc 1
  267. skip iny
  268. bne -
  269. inc 210
  270. inc 252
  271. inc 244
  272. inc 254
  273. dex
  274. bpl -
  275. dec 254
  276. bit merge
  277. bmi rest'out
  278. ldy #233
  279. lda (253),y
  280. dec 1
  281. sta 53280
  282. iny
  283. inc 1
  284. lda (253),y
  285. dec 1
  286. sta 53281
  287. inc 1
  288. iny
  289. lda (253),y
  290. sta 214
  291. iny
  292. lda (253),y
  293. sta 211
  294. rest'out lda #$77
  295. sta 1
  296. lda #0
  297. sta merge
  298. cli
  299. jmp 58732
  300.  
  301. menu'entry lda #0
  302. sta 253
  303. sta 254
  304. sta temp
  305. sta flag
  306. - jsr get'number
  307. tya
  308. ldy temp
  309. sta menuy,y
  310. inc temp
  311. cpy #5
  312. bne -
  313.  
  314. jsr get'string
  315. cmp #25
  316. bcc +
  317. lda #25
  318. + sta base
  319.  
  320. ldy #0
  321. - lda ($22),y
  322. sta wordbuf,y
  323. iny
  324. cpy base
  325. bne -
  326. ;lda #0
  327. ;sta wordbuf,y
  328.  
  329. menu jsr linx
  330. ldx menuy
  331. ldy #0
  332. sty menu'current
  333. clc
  334. jsr plot
  335. jsr old'rom'patch
  336. lda menu'highlight
  337. sta mcolor
  338. jsr paint'line
  339.  
  340. menu'wait jsr getin
  341. beq menu'wait
  342. ldx #0
  343. sta flag
  344.  
  345. ldx menu'current
  346. stx temp
  347.  
  348. cmp #crsr'down
  349. beq menu'down
  350.  
  351. cmp #crsr'up
  352. beq menu'up
  353.  
  354. jsr check'hotkeys
  355.  
  356. cmp #13
  357. beq menu'select
  358.  
  359. bne menu'wait'loop
  360.  
  361. menu'wait'loop jmp menu'wait
  362.  
  363. menu'down inc menu'current
  364. lda menu'current
  365. cmp menu'items
  366. bne highlight
  367. lda #0
  368. sta menu'current
  369. jmp highlight
  370.  
  371. menu'up dec menu'current
  372. lda menu'current
  373. cmp #255
  374. beq +
  375. jmp highlight
  376.  
  377. + ldy menu'items
  378. dey
  379. sty menu'current
  380. jmp highlight
  381.  
  382. menu'select lda flag
  383. beq +
  384. lda temp
  385. jmp ++
  386. + lda menu'current
  387. + clc
  388. adc menuy
  389. tax
  390. ldy #0
  391. jsr plot
  392. jsr old'rom'patch
  393. lda menu'text
  394. sta mcolor
  395. jsr paint'line
  396.  
  397. lda menu'current
  398. clc
  399. adc #1
  400. sta box'parameters
  401. lda #0
  402. sta box'parameters+1
  403. jmp make'variable
  404.  
  405. highlight lda menuy
  406. clc
  407. adc menu'current
  408. tax
  409. ldy #0
  410. clc
  411. jsr plot
  412. jsr old'rom'patch
  413. lda menu'highlight
  414. sta mcolor
  415. jsr paint'line
  416.  
  417. lda menuy
  418. clc
  419. adc temp
  420. tax
  421. ldy #0
  422. clc
  423. jsr plot
  424. jsr old'rom'patch
  425. lda menu'text
  426. sta mcolor
  427. jsr paint'line
  428.  
  429. jmp menu'wait
  430.  
  431. paint'line ldy menux1
  432. - lda mcolor
  433. sta (243),y
  434. bmi +
  435. lda (209),y
  436. eor #128
  437. sta (209),y
  438. + iny
  439. cpy menux2
  440. beq -
  441. bcc -
  442. rts
  443.  
  444. check'hotkeys tax
  445. tya
  446. pha
  447. ldy #0
  448. txa
  449. - cmp wordbuf,y
  450. bne +
  451. sty menu'current
  452. ldx #13
  453. stx flag
  454. + iny
  455. cpy base
  456. bne -
  457.  
  458.  
  459. + pla
  460. tay
  461. txa
  462. rts
  463.  
  464. ;**** get number from BASIC ****
  465.  
  466. get'number jsr $aefd
  467. jsr $ad8a
  468. jmp $b7f7
  469.  
  470.  
  471.  
  472. ;***** get string from BASIC ****
  473.  
  474. get'string jsr $aefd
  475. jsr $ad9e
  476. jsr $b6a3
  477.  
  478. ldx $22
  479. ldy $23
  480. rts
  481.  
  482. print'at jsr linx
  483. jsr get'number
  484. sty 211
  485. jsr get'number
  486. sty 214
  487. jsr 58732
  488. jsr get'string
  489. sta temp
  490.  
  491. print'string lda temp
  492. beq +
  493. ldy #0
  494. - lda ($22),y
  495. jsr chrout
  496. iny
  497. cpy temp
  498. bne -
  499. + rts
  500.  
  501. ucase jsr get'string
  502. cmp #0
  503. beq uout
  504. sta temp
  505. ldy #0
  506. - lda ($22),y
  507. cmp #65
  508. bcc +
  509. ora #128
  510. sta ($22),y
  511. + iny
  512. cpy temp
  513. bne -
  514. uout rts
  515.  
  516. lcase jsr get'string
  517. sta temp
  518. cmp #0
  519. beq +
  520. ldy #0
  521. - lda ($22),y
  522. and #127
  523. sta ($22),y
  524. iny
  525. cpy temp
  526. bne -
  527. / rts
  528.  
  529. center jsr get'number
  530. tya
  531. tax
  532. ldy #0
  533. clc
  534. jsr plot
  535.  
  536. jsr get'string
  537. mcenter sta temp
  538.  
  539. lsr
  540. sta flag
  541. lda #20
  542. sec
  543. sbc flag
  544. sta 211
  545. jsr 58732
  546. jmp print'string
  547.  
  548. old'rom'patch lda 210
  549. sec
  550. sbc 648
  551. clc
  552. adc #$d8
  553. sta 244
  554. lda 209
  555. sta 243
  556. rts
  557.  
  558. screen'merge lda #255
  559. sta merge
  560. jmp restore'ii
  561.  
  562. char'swap jsr get'number
  563. sty menuy
  564. jsr get'number
  565. sty menuy+1
  566. jsr get'number
  567. sty menuy+2
  568.  
  569. jsr linx
  570. lda #19
  571. jsr chrout
  572. jsr old'rom'patch
  573. lda #24
  574. sta 251
  575.  
  576. - ldy #39
  577. - lda (209),y
  578. cmp menuy
  579. bne no'match
  580. lda menuy+1
  581. sta (209),y
  582. lda menuy+2
  583. bmi no'match
  584. sta (243),y
  585. no'match dey
  586. bpl -
  587. dec 251
  588. bmi swap'out
  589. lda #40
  590. clc
  591. adc 209
  592. sta 209
  593. lda #0
  594. adc 210
  595. sta 210
  596. clc
  597. lda #40
  598. adc 243
  599. sta 243
  600. lda #0
  601. adc 244
  602. sta 244
  603. jmp --
  604.  
  605. swap'out lda #19
  606. jmp chrout
  607.  
  608. color'swap jsr get'number
  609. sty menuy
  610. jsr get'number
  611. sty menuy+1
  612.  
  613. jsr linx
  614. lda #19
  615. jsr chrout
  616. jsr old'rom'patch
  617. lda #24
  618. sta 251
  619.  
  620. - ldy #39
  621. - lda (243),y
  622. and #15
  623. cmp menuy
  624. bne no'matchc
  625. lda menuy+1
  626. sta (243),y
  627. no'matchc dey
  628. bpl -
  629. dec 251
  630. bmi swap'out
  631.  
  632. clc
  633. lda #40
  634. adc 243
  635. sta 243
  636. lda #0
  637. adc 244
  638. sta 244
  639. jmp --
  640.  
  641. shade'area lda #3
  642. sta parm'count
  643. lda #255
  644. sta shade
  645. jmp box'ii
  646.  
  647. directory jsr get'string
  648. jsr setnam
  649. jsr get'number
  650. tya
  651. tax
  652. lda #2
  653. ldy #0 ; must be 0 for directory
  654. jsr setlfs
  655. jsr open
  656.  
  657. jsr clrchn
  658. ldx #2
  659. jsr chkin
  660.  
  661. jsr getin ;skip unused bytes
  662. jsr getin
  663. jsr getin
  664. jsr getin
  665.  
  666. get'blocks jsr getin
  667. sta 251
  668. jsr getin
  669. ldx 251
  670. jsr print'number ;$bdcd.  part of list command
  671. lda " "
  672. jsr chrout
  673. jsr chrout
  674.  
  675. get'name lda 653
  676. bne get'name
  677. jsr getin
  678. beq next'name
  679. jsr chrout
  680. jsr readst
  681. and #66
  682. bne end'dir
  683. beq get'name
  684.  
  685. next'name jsr getin
  686. beq end'dir
  687. jsr getin
  688. lda #13
  689. jsr chrout
  690. jmp get'blocks
  691.  
  692. end'dir lda #2
  693. jsr close
  694. jmp clrchn
  695.  
  696.  
  697. brancher jsr get'string
  698. sta 252
  699. - jsr getin
  700. beq -
  701.  
  702. ldy #0
  703. - cmp ($22),y
  704. bne +
  705. iny
  706. tya
  707. sta box'parameters
  708. lda #0
  709. sta box'parameters+1
  710. jmp make'variable
  711. + iny
  712. cpy 252
  713. bne -
  714. beq --
  715.  
  716. ;store lsb in 253
  717. ;store msb in 254
  718. ;makes variable, f%
  719.  
  720. make'variable lda "f"
  721. sta 251
  722. lda "%"
  723. sta 252
  724. lda #0
  725. sta 253
  726.  
  727. lda $7a
  728. pha
  729. lda $7b
  730. pha
  731.  
  732. lda <251
  733. sta $7a
  734. lda >251
  735. sta $7b
  736. jsr $b08b
  737. ldy #0
  738. lda box'parameters+1 ;high byte
  739. sta ($47),y
  740. iny
  741. lda box'parameters ;low byte
  742. sta ($47),y
  743. pla
  744. sta $7b
  745. pla
  746. sta $7a
  747. rts
  748.  
  749. bload jsr get'string
  750. jsr setnam
  751. jsr get'number
  752. tya
  753. tax
  754. lda #2
  755. ldy #0
  756. jsr setlfs
  757. jsr get'number
  758. sty base
  759. sta base+1
  760. ldx $14
  761. ldy $15
  762. lda #0
  763. jmp load
  764.  
  765. do'box stx 251
  766. sty 252
  767. ldy #5
  768. - lda (251),y
  769. sta box'parameters,y
  770. dey
  771. bpl -
  772. jmp fill'box
  773.  
  774. do'frame stx 251
  775. sty 252
  776. ldy #4
  777. - lda (251),y
  778. sta box'parameters,y
  779. dey
  780. bpl -
  781. jmp frame'up
  782.  
  783. frame'entry lda #4
  784. sta parm'count
  785. frame'ii lda #0
  786. sta temp
  787. - jsr get'number
  788. tya
  789. ldy temp
  790. sta box'parameters,y
  791. inc temp
  792. cpy parm'count
  793. bne -
  794.  
  795. frame'up jsr linx
  796. lda 214
  797. pha
  798. lda 211
  799. pha
  800. frame'start ldx box'parameters+2
  801. ldy #0
  802. clc
  803. jsr plot  
  804. jsr old'rom'patch
  805. ;dec b